package bookstore.service;

import bookstore.idao.ICategoryDao;
import bookstore.iservice.ICategoryService;
import bookstore.model.Category;
import java.util.List;

public class CategoryService implements ICategoryService {

    private ICategoryDao categoryDao;

    @Override
    public void setCategoryDao(ICategoryDao categoryDao) {
        this.categoryDao = categoryDao;
    }

    @Override
    public void addCategory(Category category) {
        categoryDao.insert(category);
    }

    @Override
    public void editCategory(Category category) {
        categoryDao.update(category);
    }

    @Override
    public void deleteCategory(Integer id) {
        categoryDao.delete(id);
    }

    @Override
    public Category findCategoryById(Integer id) {
        return categoryDao.findById(id);
    }

    @Override
    public List<Category> findAllCategories() {
        return categoryDao.findAll();
    }
}
